package com.java.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import java.io.Serializable;

@Data
@TableName("user")
public class User implements Serializable {
    public static final long serialVersion=1L;

    @JsonProperty("user_id") //jackson的注解，用于进行属性注解，使json key 与 属性对应
    @TableId(type = IdType.AUTO)
    private Integer userId;
    @Length(min = 6)
    private String userName;
    //忽略属性，不生成json,也不接受json ,@JsonIgnore
    // @JsonInclude(JsonInclude.Include.NON_NULL) 当这个值为空的时候不生成json，不为空生成
    //不影响接受json
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @NotBlank
    private String password;
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @NotBlank
    private String userPhonenumber;
}
